#!/bin/bash

#获取实际的屏幕大小
echo "获取实际的屏幕大小:"
Actual_screen=$(busctl --user call org.ukui.panel /panel/position org.ukui.panel GetPrimaryScreenPhysicalGeometry)
echo ${Actual_screen}
Actual_screen=$(echo ${Actual_screen#*i})
echo ${Actual_screen}
Actual_post1=$(echo ${Actual_screen%%i*})
echo "第一个参数:"
echo ${Actual_post1}
Actual_screen=$(echo ${Actual_screen#*i})
Actual_post2=$(echo ${Actual_screen%%i*})
echo "第二个参数:"
echo ${Actual_post2}
Actual_screen=$(echo ${Actual_screen#*i})
Actual_post3=$(echo ${Actual_screen%%i*})
echo "第三个参数:"
echo ${Actual_post3}
Actual_screen=$(echo ${Actual_screen#*i})
Actual_post4=$(echo ${Actual_screen%%i*})
echo "第四个参数:"
echo ${Actual_post4}
Actual_screen=$(echo ${Actual_screen#*i})
Actual_post5=$(echo ${Actual_screen%%i*})
echo "第五个参数:"
echo ${Actual_post5}
Actual_screen=$(echo ${Actual_screen#*i})
Actual_post6=$(echo ${Actual_screen%%s*})
echo "第六个参数:"
echo ${Actual_post6}
Actual_post7=$(echo ${Actual_screen#*\"})
Actual_post7=$(echo ${Actual_post7%%\"*})
echo "第七个参数:"
echo ${Actual_post7}


#获取屏幕可用区域
echo "获取屏幕可用区域:"
Available_screen=$(busctl --user call org.ukui.panel /panel/position org.ukui.panel GetPrimaryScreenAvailableGeometry)
echo ${Available_screen}
Available_screen=$(echo ${Available_screen#*i})
echo ${Available_screen}
Available_post1=$(echo ${Available_screen%%i*})
echo "第一个参数:"
echo ${Available_post1}
Available_screen=$(echo ${Available_screen#*i})
Available_post2=$(echo ${Available_screen%%i*})
echo "第二个参数:"
echo ${Available_post2}
Available_screen=$(echo ${Available_screen#*i})
Available_post3=$(echo ${Available_screen%%i*})
echo "第三个参数:"
echo ${Available_post3}
Available_screen=$(echo ${Available_screen#*i})
Available_post4=$(echo ${Available_screen%%i*})
echo "第四个参数:"
echo ${Available_post4}
Available_screen=$(echo ${Available_screen#*i})
Available_post5=$(echo ${Available_screen%%i*})
echo "第五个参数:"
echo ${Available_post5}

if [ "$Actual_post7" == "Bottom" ];then
echo "任务栏在底部"
screenx=24
screeny=$(((Actual_post4-Available_post4)/2+Available_post4))
#右键开始菜单
xdotool mousemove ${screenx} ${screeny} click 3 
fi

if [ "$Actual_post7" == "Top" ];then
echo "任务栏在上面"
screenx=24
screeny=$(((Actual_post5)/2))
#右键开始菜单
xdotool mousemove ${screenx} ${screeny} click 3 
fi

if [ "$Actual_post7" == "Right" ];then
echo "任务栏在右侧"
screenx=$((Available_post3+Actual_post5/2))
screeny=30
#右键开始菜单
xdotool mousemove ${screenx} ${screeny} click 3 
fi

if [ ${Actual_post7} == "Left" ]; then
echo "任务栏在左侧"
screenx=$((Available_post1/2))
screeny=30
#右键开始菜单
xdotool mousemove ${screenx} ${screeny} click 3 
fi

